﻿function NeatDialog(sHTML, sTitle, bCancel,width)
{
  window.neatDialog = null;
  this.elt = null;
  if (document.createElement  &&  document.getElementById)
  {
    var dg = document.createElement("div");
    dg.className = "neat-dialog";
	dg.style.width = width+"px";
    dg.innerHTML = sHTML;

    var dbg = document.createElement("div");
    dbg.id = "nd-bdg";
    dbg.className = "neat-dialog-bg";

    var dgc = document.createElement("div");
    dgc.className = "neat-dialog-cont";
    dgc.appendChild(dbg);
    dgc.appendChild(dg);

    if (document.body.offsetLeft > 0)
      dgc.style.marginLeft = document.body.offsetLeft + "px";

    document.body.appendChild(dgc);
    if (bCancel) document.getElementById("nd-cancel").onclick = function()
    {
      window.neatDialog.close();
    };
    this.elt = dgc;
    window.neatDialog = this;
  }
}
NeatDialog.prototype.close = function()
{
  if (this.elt)
  {
    this.elt.style.display = "none";
    this.elt.parentNode.removeChild(this.elt);
  }
  window.neatDialog = null;
}

function openDiv(url,title,clstxt,width,height)
{
    var sHTML = '<div class="neat-dialog-titlebg" style="width:'+width+'px;"><span class=pop_left style="margin:5px 5px 0px 5px">'+unescape(title)+'</span><span class=pop_right style="width:18px;height:25px;padding-top:10px; margin-right:10px" onclick="parent.window.neatDialog.close()" ><a href=javascript:void(0) onmouseout=MM_swapImgRestore() onmouseover=MM_swapImage("Image2","","/Images/icon_pop_close2.gif",1)><img src=/Images/icon_pop_close.gif title="'+clstxt+'"  border="0" name="Image2" border="0" id="Image2"  /></a></span></div><iframe scrolling="auto" frameborder="0" marginheight="0" marginwidth="0" width="'+width+'" height="'+height+'" src="'+url+'"><button onclick="window.neatDialog.close()">'+clstxt+'</button>';
    new NeatDialog(sHTML, "italki.com", false,width);
}